<script type="text/javascript">
jQuery('#enquiry_form').submit(function(e) {
	
	e.preventDefault();
	e.stopPropagation();
	
	var form = jQuery('#enquiry_form');
	var overlay = jQuery("#overlay");
	var container = jQuery("#overlay .overlay_container");
	var url = form.attr('action');
	var data = form.serializeArray();

	// send data from the form and load response
	container.html('');
	overlay.addClass("loading");
	container.load(url, data, function(){
		overlay.removeClass("loading");
	}); 		
});
</script>


<h1>Product enquiry</h1>

<form id="enquiry_form" method="post" action="<?=site_url('wishlist/submit_enquiry') ?>">
    
    <div class="preview">
                    
        <? if (count($products)>1) { ?> 
                    
            <!-- FIX ME: Move this class to the stylesheet, there should be no inline styling here -->
            <div class="headercontain" style="margin-top:-2em;" >
                <p>List of products:</p>
            </div>    
    
            <div class="contain">
            
                <?  
                $max_items = 10;
                $more_items = 0;
                ?>
                                      
                    <p> 
                    <? foreach($products as $product) { 
                        if ($max_items>=1){ ?>
                            <?=$product["Name_Products"]?>
                            <input type="hidden" name="products[]" value="<?=$product["id_Products"]?>" />
                            <br />
                        <? } else { 
                            $more_items++;
                        }
                        $max_items--;
                    } 
                    ?>
                        
                    <?
                    if ($more_items==1) {
                    ?>
                        <?=$products[count($products)-1]["Name_Products"]?>
                        <input type="hidden" name="products[]" value="<?=$products[count($products)-1]["id_Products"]?>" />
                        <br />
                    <? 
                    } else if ($more_items>1) {
                    ?>
                        ...<?=$more_items?> other products
                    <? } ?>                
                    </p>     
    
                                
            </div>            
    
        <? } else { ?> 
    
    
            <div class="contain">
    
                <img height="66" border="0" width="106" alt="" src="<?=base_url().UPLOADS_FOLDER.PRODUCT_IMG_FOLDER.thumbnail($products[0]["Main_Image"])?>"/>
                <p>
                  <strong>
                        <?=$products[0]["Name_Products"]?>
                        <input type="hidden" name="products[]" value="<?=$products[0]["id_Products"]?>" />
                  </strong>
                </p>   
                  
                <p>
                    <?=$products[0]["Introduction_Products"]?>
                </p>   
                
            </div>              
    
        <? } ?>    
       
    </div>



    <label>Your email</label>
    <input type="text" class="inputbox" name="sender_email" disabled="disabled" value="<?=$sender_email?>" />

    <label>Your message</label>
    <textarea class="inputbox" name="message"></textarea>
    

	<br /><br /><br /><br />


	<!-- FIX ME: Move this class to the stylesheet, there should be no inline styling here -->
	<div class="bottom_buttons" style="position:absolute;bottom:30px">

        <input type="hidden" name="token" id="token" value="<?=$token?>" />
        <input class="button" type="submit" value="SEND" />    
        <a class="button cancel" href="#">CANCEL</a>

	</div>

</form>


